﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using QLKDS.Reports;
using QLKDS.DAL;

namespace QLKDS.Forms.Report
{
    public partial class frmBookReport : DevExpress.XtraEditors.XtraForm
    {
        StoreManager storeManager = new StoreManager();
        public frmBookReport()
        {
            InitializeComponent();
        }

        private void frmBookReport_Load(object sender, EventArgs e)
        {
            this.lueStore.Properties.DataSource = this.storeManager.ListStore();
            this.lueStore.Properties.ValueMember = "Id";
            this.lueStore.Properties.DisplayMember = "Name";
        }

        private void btnReport_Click(object sender, EventArgs e)
        {
            if (this.lueStore.Text.Trim() == string.Empty)
            {
                this.dxepStore.SetError(this.lueStore, "Chọn cửa hàng cần thống kê");
                    return;
            }
            else
            {
            rptBook rpt = new rptBook();
            rpt.Data((int)this.lueStore.EditValue);
            princontrol.PrintingSystem = rpt.PrintingSystem;
            
            rpt.CreateDocument();
            }
        }

        private void lueStore_EditValueChanged(object sender, EventArgs e)
        {
            if (this.lueStore.Text.Trim() != string.Empty)
            {
                this.dxepStore.ClearErrors();
            }
        }
    }
}